const KoaRouter = require('@koa/router')
const {
    create,
    lists,
    detail,
    modify,
    removeMoment
} = require('../controller/moment.controller')
const {
    verifyAuth
} = require('../middleware/login.middleware')
const {
    verifyPermission
} = require('../middleware/permission.middleware')

const momentRouter = new KoaRouter({
    prefix: '/moment'
})

momentRouter.post('/upload', verifyAuth, create)
// 查询列表
momentRouter.get('/lists', lists)
// 查询详情
momentRouter.get('/detail/:momentId', detail)
// 修改某条数据的内容
momentRouter.patch('/modify/:momentId', verifyAuth, verifyPermission, modify)
// 删除动态
momentRouter.delete('/remove/:momentId', verifyAuth, verifyPermission, removeMoment)

module.exports = momentRouter